"""
@file:   manage
@author: FrankYi
@date:   2020/08/13
@desc:
"""
from flask_script import Manager
from app import create_app
from flask_migrate import Migrate,MigrateCommand
from models import db

app = create_app()
manager = Manager(app)



with app.app_context():
    migrate = Migrate()
    if db.engine.url.drivername == 'sqlite':
        migrate.init_app(app, db, render_as_batch=True)
    else:
        migrate.init_app(app, db)

manager.add_command('db', MigrateCommand)


if __name__=='__main__':
    manager.run()